const webpack = require("webpack");
const path = require("path");

// http://webpack.github.io/docs/configuration.html
module.exports = {
    entry: {
        main: "./src/index.ts",
    },

    // Outputs compiled bundle to `./web/js/main.js`
    output: {
        path: __dirname + "/public/",
        filename: "js/[name].js",
    },

    resolve: {
        extensions: [".webpack.js", ".web.js", ".ts", ".tsx", ".js"],
    },

    module: {
        // Test file extension to run loader
        rules: [
            {
                test: /\.(glsl|vs|fs)$/,
                loader: "ts-shader-loader",
            },
            {
                test: /\.tsx?$/,
                exclude: [/node_modules/, /tsOld/],
                loader: "ts-loader",
            },
        ],
    },

    // Enables dev server to be accessed by computers in local network
    devServer: {
        host: "127.0.0.1",
        port: 8000,
        publicPath: "/public/",
        disableHostCheck: true,
    },
};
